#For Manuscript ID: ISQ-2024-07-0431.R1

#Title: Economic Sanctions and the Distribution of State Capacity in Target Countries: A Disaggregated Analysis of Developing States

#Author: Jerry Urtuzuastigui 

#Email: gurtuzua@iu.edu

#R version 1.3.1073 (2020)

##############################
#######Relevant Packages######
##############################
library(doBy)
library(DataCombine)
library(plyr)
library(lubridate)
library(dplyr)
library(splitstackshape)
library(lfe)
library(stargazer)
library(AER)
library(DAMisc)
library(multiwayvcov)
library(tidyverse)
library(ggplot2)
library(AER)
library(interplot)
library(cem)
library(foreign)
library(mvtnorm)
library(flextable)

setwd("/Users/jerryurtz89/downloads")
load("ISQ2.Rdata")
NDs<-read.csv("ISQ2.csv")

#Table 1: Distribution of Sanctions Cost (table created in Word)
table(NDs$cost_sanction)
#0
272465/469918
#57.98
#1
452/469918
#.01%
#2
736/469918
#.02%
#3
113678/469918
#24.19%
#4
56682/469918
#12.06
#5
3963/469918
#.08%
#6
21942/469918
#4.67%

#Table 2: Percentage of Sanctions by Level of Severity (table created in Word)
table(NDs$cost_sanction)
table(NDs$cost_sanction>0)
#1
452/197453
#.02%
#2
736/197453
#.04%
#3
113678/197453
#57.57%
#4
56682/197453
#28.71
#5
3963/197453
#2.01%
#6
21942/197453
#11.11%

###################################################
###################################################
###################################################
###################################################
################ Table 3 Main Models ##############
###################################################
###################################################
###################################################
###################################################
#Model 1
felm1<- felm(lnNTL ~
               lag.lncapdist
             *lag.cost_sanction
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)
summary(felm1)
stargazer(felm1)

#Model 2 
felm2<- felm(lnNTL ~
               
               lag.p_polity2+lag.lnoil+lag.lngas+
               lag.lncapdist
             *lag.cost_sanction
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)
summary(felm2)
stargazer(felm2)

#Model 3
felm3<- felm(lnNTL ~
               lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
               lag.lncapdist
             *lag.cost_sanction
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)
summary(felm3)
stargazer(felm3)

#Model 4
felm4<- felm(lnNTL ~
               lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
               lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
               +lag.lncapdist*lag.cost_sanction
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)
summary(felm4)
stargazer(felm4)

#In the capital
5.540e-03+(-9.744e-04*1.61)
exp(0.003971216)

#In the periphery
5.540e-03+(-9.744e-04*8.24)
1-exp(-0.002489056)

###################################
###################################
##############Table 4##############
###################################
###################################
#t-1
felm4.1<- felm(lnNTL ~
               lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
               lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
               +lag.lncapdist*lag.cost_sanction1
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)
summary(felm4.1)
stargazer(felm4.1)

#t-2
felm5<- felm(lnNTL ~
               lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
               lag.p_polity2+lag.lnoil+lag.lngas+
               lag.lncapdist*lag.cost_sanction2+lag.lnNTL
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)

summary(felm5)
stargazer(felm5)
#In the capital
0.005977+(-0.0008851*1.61)
exp(0.004551989)
#In the periphery
5.977e-03+(-0.0008851*8.24)
1-exp(-0.001316224)

#t-3
felm6<- felm(lnNTL ~
               lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
               lag.p_polity2+lag.lnoil+lag.lngas+
               lag.lncapdist*lag.cost_sanction3+lag.lnNTL
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)

summary(felm6)
stargazer(felm6)
#In the capital
3.832e-03+(-8.732e-04*1.61)
exp(0.002426148)
#In the periphery
3.832e-03+(-8.732e-04*8.24)
1-exp(-0.003363168)

#t-4
felm7<- felm(lnNTL ~
               lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
               lag.p_polity2+lag.lnoil+lag.lngas+
               lag.lncapdist*lag.cost_sanction4+lag.lnNTL
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)

summary(felm7)
stargazer(felm7)

#In the capital
2.667e-03+(-7.648e-04*1.61)
exp(0.001435672)
#In the periphery
2.667e-03+(-7.648e-04*8.24)
1-exp(-0.003634952)

#t-5
felm8<- felm(lnNTL ~
               lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
               lag.p_polity2+lag.lnoil+lag.lngas+
               lag.lncapdist*lag.cost_sanction5+lag.lnNTL
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)

summary(felm8)
stargazer(felm8)
#In the capital
7.223e-03+(-1.272e-03*1.61)
exp(0.00517508)
#In the periphery
7.223e-03+(-1.272e-03*8.24)
1-exp(-0.00325828)

###################################
###################################
##############Table 5##############
###################################
###################################
#t-6
felm9<- felm(lnNTL ~
               lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
               lag.p_polity2+lag.lnoil+lag.lngas+
               lag.lncapdist*lag.cost_sanction6+lag.lnNTL
             | 
               factor(ccode)+factor(year)|0|gid, data=NDs)

summary(felm9)
stargazer(felm9)
#In the capital
0.0062668+(-0.0007886*1.61)
exp(0.004997154)

#t-7
felm10<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+
                lag.lncapdist*lag.cost_sanction7+lag.lnNTL
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)

summary(felm10)
stargazer(felm10)
#In the capital
0.0095223+(-0.0016307*1.61)
exp(0.006896873)
#In the periphery
0.0095223+(-0.0016307*8.24)
1-exp(-0.003914668)

#t-8
felm11<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+
                lag.lncapdist*lag.cost_sanction8+lag.lnNTL
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)

summary(felm11)
stargazer(felm11)

#In the capital
0.0094578+(-0.0021441*1.61)
exp(0.006005799)
#In the periphery
0.0094578+(-0.0021441*8.24)
1-exp(-0.008209584)

#t-9
felm12<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+
                lag.lncapdist*lag.cost_sanction9+lag.lnNTL
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)

summary(felm12)
stargazer(felm12)
#In the capital
0.0066245+(-0.0009758*1.61)
exp(0.00517508)
0.0066245+(-0.0009758*8.24)
1-exp(-0.001416092)

#t-10
felm13<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+
                lag.lncapdist*lag.cost_sanction10+lag.lnNTL
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)

summary(felm13)
stargazer(felm13)
#In the capital
#insignificant at (ln)capdist= 1.61
#In the periphery
0.0028697+(-0.0009913*8.24)
1-exp(-0.005298612)

###################################
###################################
##############Table 6##############
###################################
###################################
#Cumulative Increase in the Capital (10 years)
#Using coefficients years t-1 to t-10
#Year 1 = 1.004 
#Year 2 = 1.004*1.0046 = 1.0086 
#Year 3 = 1.0086 * 1.0024 = 1.0110 
#Year 4 = 1.0110*1.0014 = 1.0124
#Year 5 = 1.0124*1.0052 = 1.0177
#Year 6 = 1.0177*1.005 = 1.0228
#Year 7 = 1.0228*1.0069 = 1.0299 
#Year 8 = 1.0299*1.006 = 1.0361
#Year 9 = 1.0361*1.0051 = 1.0414
#Year 10 = 1.0414 (year 10, no change - coefficient statistically 
# insignificant at lowest value of (ln)Capital Distance. See interaction plot.) 
#Cumulative change in coefficient in the capital after 10 years = 4.1%

#Cumulative Decrease in the Periphery (10 years)
#Using coefficients years t-1 to t-10
#Year 1 = -0.0025
#Year 2 = 1 - ((1 - 0.0025)*(1 - .0013)) = 0.0038 decrease
#Year 3 = 1 - ((1 - 0.0038)*(1 - 0.0034))= 0.0072 decrease
#Year 4 = 1 - ((1 - 0.0072)*(1 - 0.0036)) = 0.011 decrease
#Year 5 = 1 - ((1 - 0.011)*(1 - 0.0033)) = 0.0140 decrease
#Year 6 = 0.0140 decrease (year 6, no change, coefficient 
#statistically insignificant in periphery in year 6)
#Year 7 = 1 - ((1 - 0.0140)*(1 - 0.004)) = 0.018 decrease
#Year 8 = 1 - ((1 - 0.018)*(1 - 0.0082)) = 0.026 decrease
#Year 9 = 1 - ((1 - 0.026)*(1 - 0.0014)) = 0.0274 decrease
#Year 10 = 1 - ((1 - 0.0274)*(1 - 0.0053)) =  0.0325 decrease
#Cumulative change in coefficient in the periphery after 10 years = 3.3%

#Table 6
#Effect of Sanctions Cost in the Capital After 10 Years
#1 = 4.1% increase
#2 = 100 *((1 + 0.041)^2 - 1) = 8.4% increase
#3 = 100*((1 + 0.041)^3 - 1)= 12.8% increase
#4 = 100*((1 + 0.041)^4 - 1)= 17.4% increase
#5 = 100*((1 + 0.041)^5 - 1)= 22.3% increase
#6 = 100*((1 + 0.041)^6 - 1)= 27.3% increase

#Effect of Sanctions Cost in the Periphery After 10 Years
#1 = 3.3% decrease
#2 = ((1 - 0.033)^2) = 0.935089
#((1 - 0.935089) / 1) * 100 = 6.5% decrease
#3 = ((1 - 0.033)^3) = 0.9042311
#((1 - 0.9042311) / 1) * 100 = 9.6% decrease
#4 = ((1 - 0.033)^4) = 0.8743914
#((1 - 0.8743914) / 1) * 100 = 12.6% decrease
#5 = ((1 - 0.033)^5) = 0.8455365
#((1 - 0.8455365) / 1) * 100 = 15.5% decrease
#6 = ((1 - 0.033)^6) = 0.8176338
#((1 - 0.8176338) / 1) * 100 = 18.2% decrease

#############################################
#############################################
##############Sensitivity Analysis###########
#############################################
#############################################
#########################
########GCP as DV########
#########################
felm14<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
summary(felm14)

felm15<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction2
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm15)

felm16<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction3
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm16)

felm17<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction4
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm17)

felm18<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction5
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm18)

felm19<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction6
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm19)

felm20<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction7
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm20)

felm21<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction8
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm21)

felm22<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction9
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm22)

felm23<- felm(lngcp ~
                lag.lnpop_gpw_sum+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lngcp+
                lag.lncapdist*lag.cost_sanction10
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm23)

##########################################
########Regime Challenging Sanctions######
##########################################
felm34<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm34)

felm35<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction2
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm35)

felm36<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction3
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm36)

felm37<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction4
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm37)

felm38<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction5
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm38)

felm39<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction6
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm39)

felm40<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction7
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm40)

felm41<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction8
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm41)

felm42<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction9
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm42)

felm43<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.RCcost_sanction10
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm43)

############################
########TIES Sanctions######
############################
felm44<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm44)

felm45<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost2
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm45)

felm46<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost3
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm46)

felm47<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost4
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm47)

felm48<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost5
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm48)

felm49<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost6
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm49)

felm50<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost7
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm50)

felm51<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost8
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm51)

felm52<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost9
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm52)

felm53<- felm(lnNTL ~
                lag.lnpop_gpw_sum+lag.lngcp+lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnNTL+
                lag.lncapdist*lag.TIEScost10
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm53)

###############################################################
########Controlling for Loss-of-Strenght Gradient (CEM)########
###############################################################
#Variables used for matching, remove NAs
prop.at.urb<-na.omit(NDs[,c("lag.cost_sanction", "lag.lnpop_gpw_sum","lag.lnbdist1","lag.lngas",
                            "lag.lncapdist","lnNTL",
                            "lag.lnexcluded", "lag.lngcp")])
prop.at.urb$lag.cost_sanction <- as.integer(prop.at.urb$lag.cost_sanction)

#Create a matrix
mat.at.urb <- cem(treatment="lag.cost_sanction", data=prop.at.urb, keep.all = TRUE, drop=c("lnNTL", "lag.lncapdist"))
prop.at.urb<-data.frame(prop.at.urb)
#Regress on treatment
log.t.at.urb <-  att(mat.at.urb, lnNTL~
                       lag.lncapdist*lag.cost_sanction, data=prop.at.urb, model='linear')
summary(log.t.at.urb)

#At shortest distance from the capital in the dataset
0.04165718+(-0.01069453*1.607)
# = 0.02447107
#95% CI = 
0.02447107-(1.96*0.00598787)
0.02447107+(1.96*0.00598787)
# (0.0111678, 0.03464026)

#At furthest distance from the capital in the dataset
0.04165718+(-0.01069453*8.240)
# = -0.0442726
#95% CI = 
#-0.0442726-(1.96*0.00598787)
#-0.0442726+(1.96*0.00598787)
# (-0.05600883, 0.03253637)

###############################################################
########Controlling for Loss-of-Strenght Gradient (OLS)########
###############################################################
felm61<- felm(lnNTL ~
                lag.cost_sanction+lag.lncapdist+lag.cost_sanction:lag.lncapdist+
                lag.lnNTL+lag.lncapdist*lag.lnpop_gpw_sum+lag.lncapdist*lag.lngcp+lag.lncapdist*lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm61)
#Controlling for Loss-of-Strenght Gradient (OLS)
felm61<- felm(lnNTL ~
                lag.cost_sanction+lag.lncapdist+lag.cost_sanction:lag.lncapdist+
                lag.lnNTL+lag.lncapdist*lag.lnpop_gpw_sum+lag.lncapdist*lag.lngcp+lag.lncapdist*lag.lnexcluded+lag.lnbdist1+
                lag.p_polity2+lag.lnoil+lag.lngas
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm61)

########################
########One-by-One######
########################
felm54<- felm(lnNTL ~
                
                lag.p_polity2+
                lag.lncapdist*lag.cost_sanction
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm54)

felm55<- felm(lnNTL ~
                
                lag.p_polity2+lag.lnoil+
                lag.lncapdist*lag.cost_sanction
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm55)

felm56<- felm(lnNTL ~
                
                lag.p_polity2+lag.lnoil+lag.lngas+
                lag.lncapdist*lag.cost_sanction
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm56)

felm57<- felm(lnNTL ~
                
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnbdist1+
                lag.lncapdist*lag.cost_sanction
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm57)

felm58<- felm(lnNTL ~
                
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnbdist1+lag.lnpop_gpw_sum+
                lag.lncapdist*lag.cost_sanction
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm58)

felm59<- felm(lnNTL ~
                
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnbdist1+lag.lnpop_gpw_sum+lag.lnexcluded+
                lag.lncapdist*lag.cost_sanction
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm59)

felm60<- felm(lnNTL ~
                
                lag.p_polity2+lag.lnoil+lag.lngas+lag.lnbdist1+lag.lnpop_gpw_sum+lag.lnexcluded++lag.lngcp+
                lag.lncapdist*lag.cost_sanction
              | 
                factor(ccode)+factor(year)|0|gid, data=NDs)
stargazer(felm60)


#Table 1A: Descriptive Stats
NDs2 = subset(NDs, select = c(year, ccode, gid, lnNTL, lag.lnNTL, lag.lnpop_gpw_sum, lag.lnexcluded,
                              lag.lnbdist1, lag.p_polity2,lag.lnoil, lag.lngas, lag.lngcp, lngcp, lag.lncapdist,lag.cost_sanction,
                              lag.cost_sanction2, lag.cost_sanction3, lag.cost_sanction4, lag.cost_sanction5, lag.cost_sanction6,
                              lag.cost_sanction7, lag.cost_sanction8, lag.cost_sanction9, lag.cost_sanction10, lag.TIEScost,
                              lag.TIEScost2, lag.TIEScost3, lag.TIEScost4, lag.TIEScost5, lag.TIEScost6, lag.TIEScost7, lag.TIEScost8,
                              lag.TIEScost9,lag.TIEScost10, lag.RCcost_sanction, lag.RCcost_sanction2, lag.RCcost_sanction3, lag.RCcost_sanction4,
                              lag.RCcost_sanction5, lag.RCcost_sanction6, lag.RCcost_sanction7, lag.RCcost_sanction8, lag.RCcost_sanction9, 
                              lag.RCcost_sanction10))
NDs2 <- data.frame(NDs2)
stargazer(NDs2, omit.summary.stat = c("p25", "p75"), type = 'text')
